package com.itcast.plane.modoule.user.controller;

import com.itcast.plane.modoule.company.dto.CompanyCreatDTO;
import com.itcast.plane.modoule.user.dto.UserEditDTO;
import com.itcast.plane.modoule.user.dto.UserLoginDTO;
import com.itcast.plane.modoule.user.service.UserService;
import com.itcast.plane.util.JsonResult;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/user")
public class UserController {

    @Resource
    private UserService userService;

    @PostMapping("/add")
    public JsonResult addUser(@RequestBody UserLoginDTO userDTO){
        return userService.addUser(userDTO);
    }

    @PostMapping("/login")
    public JsonResult loginUser(@RequestBody UserLoginDTO userDTO){
        return userService.loginUser(userDTO);
    }

    @PutMapping("/edit")
    public JsonResult editUser(@RequestBody UserEditDTO editDTO){
        return userService.editUser(editDTO);
    }
}
